﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataFactory;
using Serveur.DataAccess.EF;

namespace Serveur.DataFactory
{
    public class Populator
    {
        public static void Populate()
        {
            //MakeSkillsTypes();
            Race Heir = new Race() { Name = "heirs" };
            Race Renegade = new Race() { Name = "renegade" };
            
            Resources[] res = new Resources[6];
            res[1] = RandomCreator.randomResource();
            res[2] = RandomCreator.randomResource();
            res[3] = RandomCreator.randomResource();
            res[4] = RandomCreator.randomResource();
            res[5] = RandomCreator.randomResource();
            res[0] = RandomCreator.randomResource();

            UnitType[] type = new UnitType[6];
            type[0] = new UnitType() { Name = "footman", ID = 1 };
            type[1] = new UnitType() { Name = "archer", ID = 2 };
            type[2] = new UnitType() { Name = "knight", ID = 3 };
            type[3] = new UnitType() { Name = "militian", ID = 4 };
            type[4] = new UnitType() { Name = "knife_thrower", ID = 0 };
            type[5] = new UnitType() { Name = "ranger", ID = 5 };

            for (int i = 0; i < 6; i++)
            {
                type[i].Statistics = StatisticsFactory.getUnitStatistics(type[i].Name);
                type[i].Price = res[i];
                if (i < 3)
                    type[i].Race = Heir;
                else
                    type[i].Race = Renegade;
                model.AddToUnitTypeJeu(type[i]);
            }
            model.SaveChanges();
        }

        /*private static void MakeSkillsTypes()
        {
            skillTypes[0] = new SkillType() { Name = "Attack" };
            skillTypes[1] = new SkillType() { Name = "Defense" };
            skillTypes[2] = new SkillType() { Name = "Assistance" };
            foreach (var item in skillTypes)
	        {
		        model.AddToSkillTypeJeu(item);
	        }
            model.SaveChanges();
        }*/

        //private static void MakeRaces()
        //{
        //    races[0] = new Race() { Name = "Heirs" };
        //    races[1] = new Race() { Name = "Renegades" };
        //    races[2] = new Race() { Name = "None" };
        //    foreach (var item in races)
        //    {
        //        model.AddToRaceJeu(item);
        //    }
        //    model.SaveChanges();
        //}

        private static Race[] races = new Race[3];
        private static Serveur.DataAccess.EF.GameEntitiesContainer model = new Serveur.DataAccess.EF.GameEntitiesContainer();
    }
}
